colorAdminApp.controller('passwordUpdateController', function($scope,$rootScope,$http,$state,$stateParams,modalService,passwordService) {
	
	    $scope.orinPassword="";
	    $scope.newPassword="";
	    $scope.confirmNewPassword="";
	    
	    $scope.checkNewPassword=function(){
	    	passwordService.checkNewPassword($scope.newPassword);
	    }
	    
	    $scope.checkConfirmNewPassword=function(){
	     	passwordService.checkConfirmNewPassword($scope.newPassword,$scope.confirmNewPassword);
	    }
	 
		$scope.save=function(){
			if(passwordService.checkNewPassword($scope.newPassword)==false){
				return;
			}
			if(passwordService.checkConfirmNewPassword($scope.newPassword,$scope.confirmNewPassword)==false){
				return;
			}
			var entity={"newPassword":$scope.confirmNewPassword,"orinPassword":$scope.orinPassword};
			$http.post('core/user/updatePassword.htm',{params:entity}).success(function(data, status, headers, config) {
			    modalService.showAlertModal('注意',data.message);
			}).error(function(data, status, headers, config) {
		    	alert(data);
	        });  
		}
	
});
